import { validatenull } from '@/utils/validate'

export function packageImgList(list) {
  if (!validatenull(list)) {
    const nameList = []
    const imgList = []
    list.forEach(
      item => {
        if (!validatenull(item) && !validatenull(item.names) && !validatenull(item.maxImgs)) {
          nameList.push(item.names)
          const names = item.names.split(',')
          const imgs = item.maxImgs.split(',')
          names.forEach(
            (item, index) => {
              imgList.push({ name: item, url: imgs[index] })
            }
          )
        }
      }
    )
    return [nameList, imgList]
  }
}
